# WISP in a box
# Copyright (C) 2009 Meraka Institute of the CSIR
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# read: https://wiki.ubuntu.com/PackagingGuide/Complete                                                                                      



# - configuration -------------------------------------------------------------


# - paths ---------------------------------------------------------------------
PKG_BUILD_DIR=$(BUILD_DIR)/ubuntu-archive/hardy


all : packages


packages : clean prep
	@echo
	@echo "Building packages in: $(PKG_BUILD_DIR)"
	@echo
	@echo "Now building: $(PKG_BUILD_DIR)/wispinabox-freeradius-1.1.7-1"
	cd $(PKG_BUILD_DIR)/wispinabox-freeradius-1.1.7-1 ; fakeroot dpkg-buildpackage -b -uc
	@echo "Now building: $(PKG_BUILD_DIR)/wispinabox-dashboard-0.1-1"
	cd $(PKG_BUILD_DIR)/wispinabox-dashboard-0.1-1 ; fakeroot dpkg-buildpackage -b -uc

prep : # sources hooks-debian
	@echo
	@echo "Initializing package build environment: $(PKG_BUILD_DIR)"
	@if ! test -d $(PKG_BUILD_DIR) ; then mkdir -p $(PKG_BUILD_DIR) ; fi
	cp -a wispinabox-freeradius $(PKG_BUILD_DIR)/wispinabox-freeradius-1.1.7-1
	cp -a wispinabox-dashboard $(PKG_BUILD_DIR)/wispinabox-dashboard-0.1-1
	cp -r ../dashboard $(PKG_BUILD_DIR)/wispinabox-dashboard-0.1-1
	find $(PKG_BUILD_DIR) -name ".svn" | xargs rm -rf


clean :
	@echo
	@echo "Cleaning" 
	rm -rf $(BUILD_DIR)/ubuntu-archive
	rm -rf $(BUILD_DIR)/remaster-apt-cache/wispinabox*
	rm -rf ../../ubuntu-archive/hardy/wispinabox*
